package com.u2b.servlet;

import java.io.IOException;
import java.util.HashMap;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.u2b.dispatcher.DeleteDispatcher;

import com.u2b.servlet.utils.ParameterParser;
import com.u2b.servlet.utils.SendToClient;
import com.u2b.servlet.utils.UrlInterceptor;

/*
 *    1./delete/status
 *    2./delete/activity
 */

public class DeleteAction extends HttpServlet
{

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse resp) throws ServletException, IOException
    {

        SendToClient sendToClient = new SendToClient();
        String action = UrlInterceptor.intercept(request);
        ParameterParser ppr = new ParameterParser();
        DeleteDispatcher DeleteDispatcher = new DeleteDispatcher();
        HashMap<String, Object> initValues = ppr.initFormRequest(request);
        Object obj = DeleteDispatcher.dispatcer(action, initValues, request);
        sendToClient.sendMessage(request, resp, obj);
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
    {
        doPost(req, resp);

    }
}
